Networks are widely used to allow computers to exchange data. Most data networks are packet switched networks in which data is communicated from one computer to another by controlling the routing of packets through the network. As each network device receives a packet, it processes the packet based on the nature of the information in the packet. For example, a network device receiving a packet may identify the packet as containing data for an application program on that device and deliver the data in the packet to that application program. Alternatively, the network device may recognize that the packet contains data for another network device and may either forward the packet so that it reaches the other network device or may simply ignore the packet.
Each packet traditionally includes header information that enables network devices to process the packet properly. The overall format of a packet is specified by a network protocol, which allows any device connected to a network to interpret a properly formatted packet. The protocol, for example, may require some portion of the header information to identify the destination of the packet. A device receiving a packet can use this portion of the header information to route the packet appropriately.
The protocol may also require that some portion of the header information contain information that allows devices processing packets to identify when an error has occurred in the transmission of the packet. For example, the header may indicate the amount of data that should be present in the packet or may include one or more “checksums” or other error detecting codes that allow the computer receiving the packet to determine whether the packet, or some portion of the packet, was altered after it was transmitted. Often, an initial step in processing a packet in accordance with a protocol is to validate that the packet complies with the requirements of the protocol.
Most networks employ multiple protocols. Each protocol aids in routing a packet to a particular hierarchical layer within a network. Often, these protocols are applied sequentially in what is commonly referred to as a “layered protocol.” The highest protocol layer may provide information that allows a particular application running on the computer to obtain and use information in packets transmitted over the network. Lower protocol layers may provide information for routing a packet to a particular computer on a local network. Middle protocol layers may be used to communicate information that allows packets to be routed between different local networks. Examples of widely used protocols are the ARP (Address Resolution Protocol), IP (Internet Protocol Version 4 or Version 6) and TCP (Transmission Control Protocol). Each of these protocols performs a different function in routing information through a network. Consequently, these protocols are often used together in a TCP/IP/ARP layered protocol.
Each computer connected to a network contains hardware and software for processing packets according to each protocol in the layered protocol. The hardware is usually a network interface card. The software is usually part of the computer operating system called a “network stack.”
Traditionally, network stacks have been implemented as multiple separate modules. The work required for processing a packet in accordance with the protocol at each of the protocol layers is often performed in a separate module. Each module processes the packet and then passes it on for further processing by the module that implements the processing at the next protocol layer. By keeping the modules separate, software design implementation and maintenance may be simplified.
Typically, a packet has a separate header for each protocol layer. At each layer in the network stack, the header associated with a protocol layer is processed.
However, processing of packet headers is not always performed exclusively in the network stack. It is known to construct a network interface card that computes the TCP and/or IP checksum of a packet. When a network interface card can validate that a packet has a checksum indicating no alterations were made to the packet after it was transmitted, the network interface card may set a bit associated with the packet. Software within the network stack may forego processing the checksum associated with a packet if that bit is set.